<?php
	#linkbar.php	
	
include_once("inc/config.inc.php"); 
include_once("inc/coreFX.inc.php"); 
include_once($cfile); 
include_once($ffile); 
if(function_exists('get_stats')) { 
	$boxes = 1;  
	$mostComments = get_stats("mostcomments"); 
	$mostViews = get_stats("mostviewed"); 
	$popTags = get_stats("poptags");
	$newestComments = get_stats("newestcomments");   
}
?>	

<form action="<?=$publicPath;?>search.php" method="post">
<fieldset style="text-align:left;padding:7px;" class="full">
	<legend><b>Search</b></legend>
		<input type="text" style="font-family:tahoma;font-size:12px;" class="sidebarText" name="q" size="25" id="q" /><br />
		<br />Search: <input type="submit" name="submit" value="Posts" />	
		<input type="button" name="searchTags" onclick="javascript:tag_search()" value="Tags" />
</fieldset>
<br />

<fieldset style="text-align:left;padding:7px;" class="full">
	<legend><b>Important Links</b></legend>
		* <a href="http://smallaxesolutions.com">Small Axe</a><br />
		* <a href="http://www.php.net">PHP</a><br />
		* <a href="http://www.mysql.org">MySQL</a><br />
		* <a href="http://pnotepad.org">Programmer's Notepad</a><br />
		* <a href="http://www.codingmonkeys.de">SubEthaEdit</a><br />
		* <a href="http://sqlite.org">SQLite</a><br />
		* <a href="http://www.caminobrowser.org">Camino</a><br />
		* <a href="http://getfirefox.com">Mozilla Firefox</a><br />	
		* <a href="http://gaim.sourceforge.net">Gaim</a><br />	
		* <a href="http://httpd.apache.org">Apache</a><br />
		* <a href="http://phpmyadmin.net">phpMyAdmin</a><br />		
		* <a href="http://postgresql.org">PostgreSQL</a><br />
</fieldset><br />

<?php if(is_array($mostViews) && $boxes) { /* if it's not an array, skip this part */ ?>
<fieldset style="text-align:left;padding:7px;" class="full">
	<legend><b>Most Popular Stories</b></legend>
<?php
	foreach($mostViews as $k=>$v) { 
		echo "\t\t* <a href=\"/read.php/".$v['id']."/".stripslashes(permalink_title($v['title'])).".html\">"
		. stripslashes($v['title'])."</a><br />\n\t\t&nbsp;&nbsp;&nbsp;(".$v['views']." view";
		if($v['views'] > 1) { echo "s"; }
		echo ")<br />\n";
	}
?>
</fieldset><br />
<?php } ?>

<?php if(is_array($newestComments) && $boxes) { /* if it's not an array, skip this part */ ?>
<fieldset style="text-align:left;padding:7px;" class="full">
	<legend><b>Newest Comments</b></legend>
<?php
	foreach($newestComments as $k=>$v) { 
		echo "\t\t* <a href=\"/read.php/".$v['id']."/".stripslashes(permalink_title($v['ntitle'])).".html#".$v['commentid']."\">";
		if($v['title']) { echo stripslashes(stripslashes($v['title'])); } else { echo "[No Title]"; }
		echo "</a><br />\n";		
	}
?>
</fieldset><br />
<?php } ?>

<?php  if(is_array($mostComments) && $boxes) { /* if it's not an array, skip this part */  ?>
<fieldset style="text-align:left;padding:7px;" class="full">
	<legend><b>Most Comments</b></legend>
<?php
	foreach($mostComments as $k=>$v) { 
		echo "\t\t* <a href=\"/read.php/".$v['id']."/".stripslashes(permalink_title($v['title'])).".html\">"
		. stripslashes($v['title'])."</a><br />\n\t\t&nbsp;&nbsp;&nbsp;(".$v['mycount']." comment";
		if($v['mycount'] > 1) { echo "s"; }
		echo ")<br />\n";		
	}
?>
</fieldset><br />
<?php } ?>

<?php if(is_array($popTags) && $boxes) { /* if it's not an array, skip this part */ ?>
<fieldset style="text-align:left;padding:7px;" class="full">
	<legend><b>Popular <a href="<?=$publicPath;?>cloud.php" title="What are tags?">Tags</a></b></legend>
<?php
	foreach($popTags as $k=>$v) { 
		echo "\t\t* <a href=\"".$publicPath."blog.php/tag/".$v['tagname']."\">".stripslashes($v['tag'])
		. "</a> (".$v['mycount'].")<br />\n";		
	}
?>
</fieldset><br />
<?php } ?>


<fieldset style="text-align:left;padding:7px;" class="full">
	<legend><b>Feeds</b></legend>
	* <a href="<?php echo $publicPath.$CONFIG['rss'];?>/2.0">Main Feed (RSS 2.0)</a><br />
	* <a href="<?php echo $publicPath.$CONFIG['atom'];?>/1.0">Main Feed (Atom 1.0)</a><br />
	* <a href="<?php echo $publicPath.$CONFIG['atom'];?>/0.3">Main Feed (Atom 0.3)</a><br />	
	* <a href="<?php echo $publicPath;?>feed-comments.php">Comments (RSS 2.0)</a><br />
</fieldset>
</form>


